#include <cstdio>
#include <algorithm>
using namespace std;
const int N=303;
char o[N];int n,res;
bool vis[1<<20];
int id[N],rk;
void dfs(int x,int t,int s,int c){
	if(c<0) return;
	if(n-x+1<abs(c)) return;
	if(x>n){
		if(!c&&!vis[s]) vis[s]=1,++res;
		return;
	}
	if(o[x]!=')'){
		dfs(x+1,t,s,c+(t==1?-1:1));
		if(t<2) dfs(x+1,t+1,s,c+(t==1?-1:1));
	}
	if(o[x]!='('){
		int cur=0;
		if(~id[x]) cur=(1<<id[x]);
		dfs(x+1,t,s|cur,c+(t==1?1:-1));
		if(t<2) dfs(x+1,t+1,s|cur,c+(t==1?1:-1));
	}
}
int main(){
	freopen("bracket.in","r",stdin);
	freopen("bracket.out","w",stdout);
	scanf("%d%s",&n,o+1);
	for(int i=1;i<=n;++i)
		if(o[i]=='x') id[i]=rk++;
		else id[i]=-1;
	dfs(1,0,0,0);
	dfs(1,1,0,0);
	printf("%d\n",res);
	return 0;
}
